/**
 * 路由meta对象参数说明
 * meta: {
 *      title:          菜单栏及 tagsView 栏、菜单搜索名称（国际化）
 *      isLink：        是否超链接菜单，开启外链条件，`1、isLink: 链接地址不为空 2、isIframe:false`
 *      isHide：        是否隐藏此路由
 *      isKeepAlive：   是否缓存组件状态
 *      isAffix：       是否固定在 tagsView 栏上
 *      isIframe：      是否内嵌窗口，开启条件，`1、isIframe:true 2、isLink：链接地址不为空`
 *      roles：         当前路由权限标识，取角色管理。控制路由显示、隐藏。超级管理员：admin 普通角色：common
 *      icon：          菜单、tagsView 图标，阿里：加 `iconfont xxx`，fontawesome：加 `fa xxx`
 * }
 */

/**
 * 定义动态路由
 * @description 未开启 isRequestRoutes 为 true 时使用（前端控制路由），开启时第一个顶级 children 的路由将被替换成接口请求回来的路由数据
 * @description 各字段请查看 `/@/views/system/menu/component/addMenu.vue 下的 ruleForm`
 * @returns 返回路由菜单数据
 */
export const dynamicRoutes = [
	{
		path: '/',
		name: '/',
		component: () => import('/@/layout/index.vue'),
		redirect: '/home',
		meta: {
			isKeepAlive: true,
		},
		children: [
			{
				path: '/home',
				name: 'home',
				component: () => import('/@/views/home/index.vue'),
				meta: {
					title: '推广广场',
					isLink: '',
					isHide: false,
					isKeepAlive: true,
					isAffix: false,
					isIframe: false,
					icon: "https://ouan-retail.oss-cn-shenzhen.aliyuncs.com/web/tarbar/%E6%8E%A8%E5%B9%BF%E5%B9%BF%E5%9C%BA-%E6%9C%AA%E7%82%B9%E4%BA%AE.png",
					iconSelect: "https://ouan-retail.oss-cn-shenzhen.aliyuncs.com/web/tarbar/%E6%8E%A8%E5%B9%BF%E5%B9%BF%E5%9C%BA-%E9%80%89%E4%B8%AD.png"
				},
			},
			{
				path: '/statistics',
				name: 'statistics',
				component: () => import('/@/views/statistics/index.vue'),
				meta: {
					title: '数据中心',
					isLink: '',
					isHide: false,
					isKeepAlive: true,
					isAffix: false,
					isIframe: false,
					icon: "https://ouan-retail.oss-cn-shenzhen.aliyuncs.com/web/tarbar/%E6%95%B0%E6%8D%AE%E4%B8%AD%E5%BF%83-%E6%9C%AA%E7%82%B9%E4%BA%AE.png",
					iconSelect: "https://ouan-retail.oss-cn-shenzhen.aliyuncs.com/web/tarbar/%E6%95%B0%E6%8D%AE%E4%B8%AD%E5%BF%83-%E9%80%89%E4%B8%AD.png"
				},
				children: [
					{
						path: '/statistics/data_income',
						name: 'dataIncome',
						component: () => import('/src/views/statistics/data_income.vue'),
						meta: {
							title: '收益数据',
							isLink: '',
							isHide: true,
							isKeepAlive: true,
							isAffix: false,
							isIframe: false,
						},
					},
				]
			},
			{
				path: '/news',
				name: 'news',
				component: () => import('/@/views/news/index.vue'),
				meta: {
					title: '平台消息',
					isLink: '',
					isHide: false,
					isKeepAlive: true,
					isAffix: false,
					isIframe: false,
					icon: "https://ouan-retail.oss-cn-shenzhen.aliyuncs.com/web/tarbar/%E5%B9%B3%E5%8F%B0%E6%B6%88%E6%81%AF-%E6%9C%AA%E7%82%B9%E4%BA%AE.png",
					iconSelect: "https://ouan-retail.oss-cn-shenzhen.aliyuncs.com/web/tarbar/%E5%B9%B3%E5%8F%B0%E6%B6%88%E6%81%AF-%E9%80%89%E4%B8%AD.png"
				},
			},
			{
				path: '/course',
				name: 'course',
				component: () => import('/@/views/course/index.vue'),
				meta: {
					title: '挂载教程',
					isLink: '',
					isHide: false,
					isKeepAlive: true,
					isAffix: false,
					isIframe: false,
					icon: "https://ouan-retail.oss-cn-shenzhen.aliyuncs.com/web/tarbar/%E6%8C%82%E8%BD%BD%E6%95%99%E7%A8%8B-%E6%9C%AA%E7%82%B9%E4%BA%AE.png",
					iconSelect: "https://ouan-retail.oss-cn-shenzhen.aliyuncs.com/web/tarbar/%E6%8C%82%E8%BD%BD%E6%95%99%E7%A8%8B-%E9%80%89%E4%B8%AD.png"
				},
			},
			{
				path: '/finance',
				name: 'finance',
				component: () => import('/@/views/finance/index.vue'),
				meta: {
					title: '财务',
					isLink: '',
					isHide: false,
					isKeepAlive: true,
					isAffix: false,
					isIframe: false,
					icon: "https://ouan-retail.oss-cn-shenzhen.aliyuncs.com/web/tarbar/%E8%B4%A2%E5%8A%A1-%E6%9C%AA%E7%82%B9%E4%BA%AE.png",
					iconSelect: "https://ouan-retail.oss-cn-shenzhen.aliyuncs.com/web/tarbar/%E8%B4%A2%E5%8A%A1-%E9%80%89%E4%B8%AD.png"
				},
				children: [
					{
						path: '/finance/withdrawal_application',
						name: 'withdrawalApplication',
						component: () => import('/@/views/finance/withdrawal_application.vue'),
						meta: {
							title: '申请提现',
							isLink: '',
							isHide: true,
							isKeepAlive: true,
							isAffix: false,
							isIframe: false,
						},
					},
					{
						path: '/finance/record',
						name: 'record',
						component: () => import('/@/views/finance/record.vue'),
						meta: {
							title: '提现记录',
							isLink: '',
							isHide: true,
							isKeepAlive: true,
							isAffix: false,
							isIframe: false,
						},
					},
					{
						path: '/finance/income',
						name: 'income',
						component: () => import('/@/views/finance/income.vue'),
						meta: {
							title: '收益明细',
							isLink: '',
							isHide: true,
							isKeepAlive: true,
							isAffix: false,
							isIframe: false,
						},
					},
				]
			},
			{
				path: '/mine',
				name: 'mine',
				component: () => import('/@/views/mine/index.vue'),
				meta: {
					title: '我的',
					isLink: '',
					isHide: false,
					isKeepAlive: false,
					isAffix: false,
					isIframe: false,
					icon: "https://ouan-retail.oss-cn-shenzhen.aliyuncs.com/web/tarbar/%E6%88%91%E7%9A%84-%E6%9C%AA%E7%82%B9%E4%BA%AE.png",
					iconSelect: "https://ouan-retail.oss-cn-shenzhen.aliyuncs.com/web/tarbar/%E6%88%91%E7%9A%84-%E9%80%89%E4%B8%AD.png"
				},
				children: [
					{
						path: '/mine/payee_account',
						name: 'payeeAccount',
						component: () => import('/@/views/mine/payee_account.vue'),
						meta: {
							title: '收款账户',
							isHide: true,
						},
					},
					{
						path: '/mine/cancel_account',
						name: 'cancelAccount',
						component: () => import('/@/views/mine/cancel_account.vue'),
						meta: {
							title: '注销账户',
							isHide: true,
						},
					},
					{
						path: '/mine/auth_agreement',
						name: 'authAgreement',
						component: () => import('/@/views/mine/auth_agreement.vue'),
						meta: {
							title: '实名认证服务协议',
							isHide: true,
						},
					},
				]
			},
		],
	},
];

/**
 * 定义404、401界面
 * @link 参考：https://next.router.vuejs.org/zh/guide/essentials/history-mode.html#netlify
 */
export const notFoundAndNoPower = [
	{
		path: '/:path(.*)*',
		name: 'notFound',
		component: () => import('/@/views/error/404.vue'),
		meta: {
			title: '页面找不到',
			isHide: true,
		},
	},
	{
		path: '/401',
		name: 'noPower',
		component: () => import('/@/views/error/401.vue'),
		meta: {
			title: '页面无权限',
			isHide: true,
		},
	},
];

/**
 * 定义静态路由（默认路由）
 * 此路由不要动，前端添加路由的话，请在 `dynamicRoutes 数组` 中添加
 * @description 前端控制直接改 dynamicRoutes 中的路由，后端控制不需要修改，请求接口路由数据时，会覆盖 dynamicRoutes 第一个顶级 children 的内容（全屏，不包含 layout 中的路由出口）
 * @returns 返回路由菜单数据
 */
export const staticRoutes = [
	{
		path: '/login',
		name: 'login',
		component: () => import('/src/views/login/index.vue'),
		meta: {
			title: '登录',
		},
	},
];
